#include "BoardController.h"

#include "windows.h"

#include <boost/bind.hpp>
#include "../views/DependencyContainer.h"

using namespace Controllers;

//BoardController::BoardController(std::queue<Players::Player*> players, std::set<BoardItems::Room*> rooms, std::set<BoardItems::WeaponPiece*> weapons):
//players(players), rooms(rooms), weapons(weapons)
//{
//}
//

BoardController::BoardController(Players::Player* player): player(player)
{
	view = Views::DependencyContainer::getInstance()->getBoardViewInstance();

	connections.push_back(view->onPlayerRoomChange.connect(boost::bind(&BoardController::setPlayerPosition, this, _1)));
}

void BoardController::perform()
{
	view->askForPlayerNewPosition(player);
}

void BoardController::setPlayerPosition(BoardItems::Room* room)
{
	player->piece->room = room;
	movePerformedEvent();
}

void BoardController::moveToRoom(Players::Player* player, BoardItems::WeaponPiece* weapon, BoardItems::Room* room)
{
	player->piece->room = room;
	weapon->room = room;
}

